package com.admission.util;

import java.io.FileInputStream;
import java.io.IOException;

import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;

public class ExcelUtils {

	/**
	 * 获取2003或2010班excel通用的workbook
	 * 
	 * @param fileName
	 * @return
	 * @throws IOException
	 */
	public static Workbook getCommonWorkbook(String fileName)
			throws IOException {
		FileInputStream in = new FileInputStream(fileName);
		Workbook workbook = null;
		try {
			workbook = new HSSFWorkbook(in);

		} catch (Exception e) {
			in = new FileInputStream(fileName);
			workbook = new XSSFWorkbook(in);
		} finally {
			in.close();
		}

		return workbook;
	}

}
